projects
/
gtk4.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a5626c4
)
Bug 670499-gtk/fallback-c89.c: Add fallback for nearbyint()
author
Chun-wei Fan
<fanchunwei@src.gnome.org>
Thu, 5 Apr 2012 14:55:15 +0000
(22:55 +0800)
committer
Chun-wei Fan
<fanchunwei@src.gnome.org>
Thu, 3 May 2012 03:59:16 +0000
(11:59 +0800)
This adds a C89 implementation for nearbyint() as it is a function that
is only made available in C99.
gtk/fallback-c89.c
patch
|
blob
|
history
diff --git
a/gtk/fallback-c89.c
b/gtk/fallback-c89.c
index eb713b8b352d297fa8eebb6d36275e27c8d56f32..aaccd9d0ce12859268d2839d51712965ad45af02 100644
(file)
--- a/
gtk/fallback-c89.c
+++ b/
gtk/fallback-c89.c
@@
-53,4
+53,15
@@
rint (double x)
return ceil (x - 0.5);
}
}
-#endif
\ No newline at end of file
+#endif
+
+#ifndef HAVE_NEARBYINT
+/* Workaround for nearbyint() for non-GCC/non-C99 compilers */
+/* This is quite similar to rint() in most respects */
+
+static inline double
+nearbyint (double x)
+{
+ return floor (x + 0.5);
+}
+#endif